from flask import Flask, render_template, request, redirect, url_for, session


# 创建flask对象
def create_app():
    app = Flask(__name__)
    app.config['SECRET_KEY'] = 'gsolvit'
    from . import auth, admin, audit, employee
    app.register_blueprint(auth.bp)
    app.register_blueprint(admin.bp)
    app.register_blueprint(employee.bp)
    app.register_blueprint(audit.bp)
    return app


app = create_app()


@app.route('/', methods=['GET', 'POST'])
def index():
    return redirect(url_for('auth.admin_login'))


@app.route('/update/failed', methods=['GET', 'POST'])
def update_failed():
    return render_template('update_failed.html')


@app.route('/update/successfully', methods=['GET', 'POST'])
def update_successfully():
    return render_template('update_successfully.html')


@app.route('/delete/successfully', methods=['GET', 'POST'])
def delete_successfully():
    return render_template('delete_successfully.html')


@app.route('/delete/failed', methods=['GET', 'POST'])
def delete_failed():
    return render_template('delete_failed.html')

@app.route('/search/failed', methods=['GET', 'POST'])
def search_failed():
    return render_template('search_failed.html')

# 关于我们
@app.route('/about', methods=['GET', 'POST'])
def about():
    return render_template('about.html')
